#search-result-container
  .search_query
    %span.result_for= t('.result_for')
    %span.search_param= params[:search]
  .search_result
    %table#books-list.table-striped
      %tr.heading
        %th= t('.cover')
        %th= sortable(search_path_proc, :isbn, t('.isbn'))
        %th= sortable(search_path_proc, :name, t('.name'))
        %th= sortable(search_path_proc, :category_id, t('.category'))
        %th= sortable(search_path_proc, :author, t('.author'))
        %th= t('.description')
        - if current_user.admin?
          %th=""
      - @results.each do |book|
        %tr 
          %td.cover= image_tag book.image_url(:thumb) if book.image?
          %td.isbn= book.isbn
          %td.name= link_to book.name, book
          %td.category= book.category.try(:name)
          %td.author= book.author
          %td.description= simple_format(truncate(book.description, length: 80))
          - if current_user.admin?
            %td.action
              = link_to 'Edit', edit_book_path(book)
              = '|' 
              = link_to 'Destroy', book, method: :delete, data: { confirm: 'Are you sure?' }
  %p= will_paginate @results, renderer: BootstrapPagination::Rails
